package com.yxjx.duoxue.datamodel.course;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import com.yxjx.duoxue.datamodel.DMObject;
import com.yxjx.duoxue.utils.UIHelper;

/**
 * 课程详情页-学校信息
 *
 * @author zhangxs
 * @date 2015年2月6日
 *
 */
public class CourseDetailDTS extends DMObject implements Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 633854928500317444L;
	// 品牌历史
    private String brandHistory = "";
    // 累积服务人数(累积学员)
    private String brandStudentCount = "";
    // 教学设施
    private String envFacilities = "";
    // 卫生状况
    private String envHealth = "";
    // 老师数量
    private String teacherCount = "";
    // 平均教龄
    private String teacherAge = "";
    // 老师资历
    private String teacherQualifier = "";

    public String getBrandHistory() {
        return brandHistory;
    }

    public void setBrandHistory(String brandHistory) {
        this.brandHistory = brandHistory;
    }

    public String getBrandStudentCount() {
        return brandStudentCount;
    }

    public void setBrandStudentCount(String brandStudentCount) {
        this.brandStudentCount = brandStudentCount;
    }

    public String getEnvFacilities() {
        return envFacilities;
    }

    public void setEnvFacilities(String envFacilities) {
        this.envFacilities = envFacilities;
    }

    public String getEnvHealth() {
        return envHealth;
    }

    public void setEnvHealth(String envHealth) {
        this.envHealth = envHealth;
    }

    public String getTeacherCount() {
        return teacherCount;
    }

    public void setTeacherCount(String teacherCount) {
        this.teacherCount = teacherCount;
    }

    public String getTeacherAge() {
        return teacherAge;
    }

    public void setTeacherAge(String teacherAge) {
        this.teacherAge = teacherAge;
    }

    public String getTeacherQualifier() {
        return teacherQualifier;
    }

    public void setTeacherQualifier(String teacherQualifier) {
        this.teacherQualifier = teacherQualifier;
    }

    @Override
    public String toString() {
        return "{\"brandHistory\":\"" + brandHistory + "\", \"brandStudentCount\":\"" + brandStudentCount + "\", \"envFacilities\":\"" + envFacilities
                + "\", \"envHealth\":\"" + envHealth + "\", \"teacherCount\":\"" + teacherCount + "\", \"teacherAge\":\"" + teacherAge + "\", \"teacherQualifier\":\""
                + teacherQualifier + "\"}";
    }
    
    public static CourseDetailDTS from(String str) {
    	if (UIHelper.isEmpty(str)) {
    		return null;
    	}
    	
    	try {
			JSONObject jo = new JSONObject(str);
			CourseDetailDTS item = new CourseDetailDTS();
			item.setBrandHistory(castString(jo,"brandHistory"));
			item.setBrandStudentCount(castString(jo,"brandStudentCount"));
			item.setEnvFacilities(castString(jo,"envFacilities"));
			item.setEnvHealth(castString(jo,"envHealth"));
			item.setTeacherAge(castString(jo,"teacherAge"));
			item.setTeacherCount(castString(jo,"teacherCount"));
			item.setTeacherQualifier(castString(jo,"teacherQualifier"));
			return item;
		} catch (JSONException e) {
			e.printStackTrace();
			return null;
		}
    }

}
